import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { resolve } from 'path'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueJsx()
  ],
  build: {
    minify: 'terser',
    terserOptions: {
      compress: {
        drop_console: true,
        drop_debugger: true
      }
    },
    rollupOptions: {
      output: {
        manualChunks: {
          'vendor-vue': ['vue'],
          'vendor-tdesign': ['tdesign-vue-next'],
          'vendor-aws': ['@aws-sdk/client-s3'],
          'vendor-icons': ['@icon-park/vue-next'],
          'vendor-others': ['uuid', 'interactjs']
        }
      }
    },
    // 保持CSS文件单独
    cssCodeSplit: true,
    // 禁用源码映射以减小体积
    sourcemap: false,
    // 增加警告限制
    chunkSizeWarningLimit: 1000
  }
})
